<?php
	// list HTTP_POST_VARS
	//echo "<br><br><br><br><br>";
	$strDeleted = "no";	   
	if (isset($_POST)){		
		$strPostType = $_POST;
	}else{	 
		$strPostType = $HTTP_POST_VARS;
	}	 							  
	//echo "xx".$strPostType;
	while (list($name, $value) = each($_POST)) {		// new server version
	//while (list($name, $value) = each($HTTP_POST_VARS)) {	//old server
	  	//echo "$name = $value<br>\n";	
		// if Delete is checked remove session variable 
			//if (eregi("(chkDelete)([0-9]{1,6})",$name, $intDeleteItemNumber)){
			if (eregi("(chkDelete)([0-9]{1,9})(\_)([0-9]{1,9})(\_)([0-9]{1,9})$",$name, $intDeleteItemNumber)){	
					
					/*
					echo "<br><b>name </b>".$name."<br>";
					echo "<br><b>value </b>".$value."<br>";
					echo "<br><b>0 </b>".$intDeleteItemNumber[0]."<br>";
					echo "<br><b>1 </b>".$intDeleteItemNumber[1]."<br>";
					echo "<br><b>2 </b>".$intDeleteItemNumber[2]."<br>";
					echo "<br><b>3 </b>".$intDeleteItemNumber[3]."<br>";
					echo "<br><b>4 </b>".$intDeleteItemNumber[4]."<br>";
					echo "<br><b>5 </b>".$intDeleteItemNumber[5]."<br>";
					//*/
		
				//echo "Delete<br>";
				$strNewItem = "sesItem".$intDeleteItemNumber[2].$intDeleteItemNumber[3].$intDeleteItemNumber[4].$intDeleteItemNumber[5].$intDeleteItemNumber[6];
				//echo "<br><b>strNewItem </b>".$strNewItem."<br>";
				session_unregister($strNewItem);
				$strDeleted = "yes";
			}	

	  	// if variable is cboQuantityX_X_X then register session variable with new quantity
		//echo "b4 $strDeleted<br>\n";
		
			if($strDeleted == "no"){
				//if (eregi("(cboQuantity)([0-9]{1,6})",$name, $intItemNumber)){
				if (eregi("(cboQuantity)([0-9]{1,9})(\_)([0-9]{1,9})(\_)([0-9]{1,9})$",$name, $intItemNumber)){	
					
					/*
					echo "<br><b>name </b>".$name."<br>";
					echo "<br><b>value </b>".$value."<br>";
					echo "<br><b>0 </b>".$intItemNumber[0]."<br>";
					echo "<br><b>1 </b>".$intItemNumber[1]."<br>";
					echo "<br><b>2 </b>".$intItemNumber[2]."<br>";
					//*/
					$strNewItem = "sesItem".$intItemNumber[2].$intItemNumber[3].$intItemNumber[4].$intItemNumber[5].$intItemNumber[6];
					//echo "<br><b>strNewItem </b>".$strNewItem."<br>";
					// convert to integer in case some script kiddie has spoofed the form
					$$strNewItem = $value / 1;
					//echo "<br><b>new quantity </b>".$$strNewItem."<br>";
					//echo "<br><b>strNewItem</b> ".$strNewItem."<br>";
					session_register($strNewItem);
					$strDeleted = "no";
				}	
			}
		
	}	
?>
